{literal}
<script type="text/javascript">
	$(document).ready(function(){
		$('#viewLatest').click(function(){
			loadLatestResult();
		});
		$('#inputData').click(function(){
			showInputDiv(true);
		});
		$('#save').click(function(){
			saveInfo();
		});
	});

function saveInfo(){
	$.ajax({
		type:    "GET",
		url:	  "../Localization/saveInfo?set_ajax_view",
		data:	  "locale=" + $('#locale').val() +
			"&date=" 	+ 	$('#insertedDate').val() +
			"&amount=" 	+ 	$('#amount').val(),
		dataType: "json",
		success:	function(data) {
			loadLatestResult();
		}
	});
}

function showInputDiv(show){
	if(show){
		$('div#input').show();
		$('div#result').hide();
	}
	else{
		$('div#input').hide();
		$('div#result').show();
	}
}
function loadLatestResult(){
	$.ajax({
		type:    "GET",
		url:	  "../Localization/loadLatestResult?set_ajax_view",
		data:	  "locale=" + $('#locale').val(),
		dataType: "html",
		success:	function(data) {
			$('#result').html(data);
			showInputDiv(false);
		}
	});
}
</script>
{/literal}
<div id="test">
<table cellspacing="10">
	<tr>
		<td colspan="2"><span class="label" style="text-transform: uppercase;">Localization testing</span></td>
	</tr>
	<tr>
		<td width="100" align="left"><span class="label">Chọn locale</span></td>
		<td align="left">
			<select id="locale" name="locale">
				<option value="vi_VN">vi_VN</option>
				<option value="en_US">en_US</option>
			</select>
		</td>
	</tr>
	<tr>
		<td colspan="2">
		<div id="buttons">
			<input type="button" value="Xem giá trị sau cùng trong database" id="viewLatest">
			&nbsp;&nbsp;
			<input type="button" value="Nhập dữ liệu" id="inputData">
		</div>
		<div id="result" style="display: none;"></div>
		
		<br/>
		<div id="input" style="display: none;">
			<table>
				<tr>
					<td style="padding-right: 10px;">
						<span class="label">Ngày tháng: </span>
					</td>
					<td>
						<input type="text" name="insertedDate" id="insertedDate"/>
					</td>
				</tr>
				<tr>
					<td>
						<span class="label">Money amount: </span>
					</td>
					<td>
						<input type="text" name="amount" id="amount"/>
					</td>
				</tr>
				<tr>
					<td colspan="2">
						<input type="button" id="save" value=}Save{> 
					</td>
				</tr>
			</table>
		</div>
	</td>
	</tr>
</table>
</div>